# Contributor: Hoang Nguyen <folliekazetani@protonmail.com>
maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=popeye
pkgver=0.21.5
pkgrel=0
pkgdesc="Kubernetes cluster resource sanitizer"
url="https://popeyecli.io/"
arch="all"
license="Apache-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/derailed/popeye/archive/refs/tags/v$pkgver.tar.gz"
options="net" # download Go modules

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	GOLDFLAGS="
	-X github.com/derailed/popeye/cmd.version=v$pkgver
	-X github.com/derailed/popeye/cmd.commit=AlpineLinux
	-X github.com/derailed/popeye/cmd.date=$(date +%FT%T%Z)
	"
	go build -v -tags netgo -o $pkgname -ldflags "$GOLDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname -t "$pkgdir"/usr/bin/
}

sha512sums="
b92d28282f41889b27cf952fe0e518d210dcf4b0e0061a96b92f08bd1a91a9e38028724ad34df4f91e31650c62a3966f7298ce3b5609bb4c4c2cf8a9a1892f0d  popeye-0.21.5.tar.gz
"
